{% extends "orga/generic/list.html" %}

{% load compress %}
{% load i18n %}
{% load static %}

{% block create_button_label %}{% translate "New room" %}{% endblock create_button_label %}

{% block stylesheets %}
    {% compress css %}
        <link rel="stylesheet" href="{% static "orga/css/dragsort.css" %}">
    {% endcompress %}
{% endblock stylesheets %}

{% block scripts %}
    {% compress js %}
        <script defer src="{% static "orga/js/dragsort.js" %}"></script>
    {% endcompress %}
{% endblock scripts %}

{% block list_content %}
    <div class="table-responsive-sm">
        <table class="table table-sm table-flip table-sticky">
            <thead>
                <tr>
                    <th>{% translate "Name" %}</th>
                    <th class="numeric">{% translate "Capacity" %}</th>
                    <th></th>
                </tr>
            </thead>
            <tbody dragsort-url="{{ request.event.orga_urls.room_settings }}">
                {% for room in room_list %}
                    <tr dragsort-id="{{ room.pk }}">
                        <td>
                            <a href="{{ room.urls.edit }}">{{ room.name }}</a>
                        </td>
                        <td class="numeric">
                            {% if room.capacity %}{{ room.capacity }}{% endif %}
                        </td>
                        <td class="text-right">
                            <button draggable="true" class="btn btn-sm btn-primary mr-1 dragsort-button" title="{% translate "Move item" %}">
                                <i class="fa fa-arrows"></i>
                            </button>

                            <a href="{{ room.urls.edit }}" class="btn btn-sm btn-info">
                                <i class="fa fa-edit"></i>
                            </a>
                            <a href="{{ room.urls.delete }}" class="btn btn-sm btn-danger">
                                <i class="fa fa-trash"></i>
                            </a>
                        </td>
                    </tr>
                {% empty %}
                    <tr>
                        <td>{% translate "Please add at least one place in which sessions can take place." %}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>

    {% include "orga/includes/pagination.html" %}
{% endblock list_content %}
